package demo.lingpaoDemo;

import java.util.*;

public class demo {
    public static void main(String[] args) {
        Map<String,Integer> map = new HashMap<>();

        Random random = new Random();
        for(int i = 1;i <= 1000;i++) {
            int score = random.nextInt(101);
            String id = String.valueOf(i);
            map.put(id,score);
        }

        Set<Map.Entry<String ,Integer>> set = map.entrySet();

        List<Map.Entry<String,Integer>> list = new ArrayList<>(set);

        list.sort((e1,e2)->e2.getValue() - e1.getValue());

        for(int i = 0;i < 10 ;i++) {
            Map.Entry<String,Integer> entry = list.get(i);
            System.out.println(entry.getKey() +"："+entry.getValue());
        }


    }

}
